//
//  ForRefundTopCell.m
//  CenturyCity
//
//  Created by beisheng03 on 2018/1/16.
//  Copyright © 2018年 beisheng. All rights reserved.
//

#import "ForRefundTopCell.h"

@interface ForRefundTopCell ()

@property (weak, nonatomic) IBOutlet UILabel *leftLabel;
@property (weak, nonatomic) IBOutlet UILabel *middleLabel;
@property (weak, nonatomic) IBOutlet UILabel *rightLabel;
@property (weak, nonatomic) IBOutlet UILabel *oneLabel;
@property (weak, nonatomic) IBOutlet UILabel *twoLabel;
@property (weak, nonatomic) IBOutlet UILabel *threeLabel;
@property (weak, nonatomic) IBOutlet UIView *garyFirstView;
@property (weak, nonatomic) IBOutlet UIView *garyTwoView;
@property (weak, nonatomic) IBOutlet UIView *redVeiw;
@property (weak, nonatomic) IBOutlet UIView *lastLineVeiw;
@property (weak, nonatomic) IBOutlet UIView *bottomLineView;

@end

@implementation ForRefundTopCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.leftLabel.textColor = [UIColor colorWithHexString:@"#F15050"];
    
    self.middleLabel.textColor = darkGray;
    
    self.rightLabel.textColor = darkGray;
    
    
    self.leftLabel.font = MYFONT(13);
    self.middleLabel.font = MYFONT(13);
    self.rightLabel.font = MYFONT(13);
    
    self.oneLabel.backgroundColor = [UIColor colorWithHexString:@"#F15050"];
    self.oneLabel.font = [UIFont boldSystemFontOfSize:15];
    self.oneLabel.layer.masksToBounds = YES;
    self.oneLabel.layer.cornerRadius =  10;
    
    self.twoLabel.backgroundColor = viewBgGrey;
    self.twoLabel.font = [UIFont boldSystemFontOfSize:15];
    self.twoLabel.layer.masksToBounds = YES;
    self.twoLabel.layer.cornerRadius =  10;
   
    
    self.threeLabel.backgroundColor = viewBgGrey;
    self.threeLabel.font = [UIFont boldSystemFontOfSize:15];
    self.threeLabel.layer.masksToBounds = YES;
    self.threeLabel.layer.cornerRadius =  10;
    
    
    self.garyFirstView.backgroundColor = viewBgGrey;
    
    self.garyTwoView.backgroundColor = viewBgGrey;
    
    self.redVeiw.backgroundColor = [UIColor colorWithHexString:@"#F15050"];
    
    [self drawDashLine:self.bottomLineView lineLength:4 lineSpacing:2 lineColor:lineGray];

    
    // Initialization code
}





- (void)drawDashLine:(UIView *)lineView lineLength:(int)lineLength lineSpacing:(int)lineSpacing lineColor:(UIColor *)lineColor
{
    CAShapeLayer *shapeLayer = [CAShapeLayer layer];
    [shapeLayer setBounds:lineView.bounds];
    [shapeLayer setPosition:CGPointMake(CGRectGetWidth(lineView.frame) / 2, CGRectGetHeight(lineView.frame))];
    [shapeLayer setFillColor:[UIColor clearColor].CGColor];
    //  设置虚线颜色为blackColor
    [shapeLayer setStrokeColor:lineColor.CGColor];
    //  设置虚线宽度
    [shapeLayer setLineWidth:CGRectGetHeight(lineView.frame)];
    [shapeLayer setLineJoin:kCALineJoinRound];
    //  设置线宽，线间距
    [shapeLayer setLineDashPattern:[NSArray arrayWithObjects:[NSNumber numberWithInt:lineLength], [NSNumber numberWithInt:lineSpacing], nil]];
    //  设置路径
    CGMutablePathRef path = CGPathCreateMutable();
    CGPathMoveToPoint(path, NULL, 0, 0);
    CGPathAddLineToPoint(path, NULL, CGRectGetWidth(lineView.frame), 0);
    [shapeLayer setPath:path];
    CGPathRelease(path);
    //  把绘制好的虚线添加上来
    [lineView.layer addSublayer:shapeLayer];
}



- (void)setModel:(ApplyRefundParmModel *)model{
    _model = model;
    
    
    
    if ([_model.tag isEqualToString:@"0"]) {
        
        self.lastLineVeiw.backgroundColor = [UIColor clearColor];
        
        self.twoLabel.backgroundColor = viewBgGrey;
        
        self.garyFirstView.backgroundColor = viewBgGrey;
        
        self.redVeiw.backgroundColor = [UIColor colorWithHexString:@"#F15050"];

    } else {
        
        self.lastLineVeiw.backgroundColor = [UIColor colorWithHexString:@"#F15050"];
        
        self.twoLabel.backgroundColor = [UIColor colorWithHexString:@"#F15050"];
        
        self.garyFirstView.backgroundColor = [UIColor colorWithHexString:@"#F15050"];
        
        self.redVeiw.backgroundColor = [UIColor clearColor];
        
    }
    
    
    
    
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
